package com.jml.ArrayList;

import java.util.Arrays;

public class 数组的复制技术 {

	public static void main(String[] args) {
		//第一种复制
		Object[] objects = {1,2,3,4,5,6,7,8};
		System.out.println(objects.length);
		Object[] copyObjects = Arrays.copyOf(objects,10);
		System.out.println(copyObjects.length);

		//第二种复制
		//参数依次为:原数组-原数组其实位置-目标数组-目标数组其实位置-复制的长度
		System.arraycopy(objects,0,objects,3,3);
		for (Object o: objects) {
			System.out.println(o);
		}
	}


}
